#include<bits/stdc++.h>
using std::cin;
using std::cout;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using pii = std::pair<int, int>;
#define TESTS int _; std::cin >> _; while(_--)
#define all(a) a.begin(), a.end()
#define pb push_back
#define fi first
#define se second
#define SUM(v) std::accumulate(all(v), 0LL);
#define MIN(v) *std::min_element(all(v));
#define MAX(v) *std::max_element(all(v));
#define UNIQUE(v) std::sort(all(v)), v.erase(std::unique(all(v), v.end()));


constexpr i64 inf = 1E18, Md3 = 998244353, Md7 = 1e9 + 7;
//std::mt19937 rng {std::chrono::steady_clock::now().time_since_epoch().count()};

int main() {
	
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	
	int n;
	std::cin >> n;
	std::vector<int> h(n), ans(n);
	for(int i = 0; i < n; i++) {
		std::cin >> h[i];		
	}

	std::vector<int> stk;
	for(int i = n - 1; i >= 0; i--) {
		ans[i] = stk.size();
		while(stk.size() && stk.back() < h[i]) {
			stk.pop_back();
		}
		stk.push_back(h[i]);
	}
	for(int i = 0; i < n; i++) {
		std::cout << ans[i] << " \n"[i == n - 1];
	}


	return 0;
}